/**   
* @Package com.app.open.sys.permission.dao 
*/
package com.wlyy.bcwlw.sys.permission.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.rework.joss.persistence.convention.BaseDao;
import com.wlyy.bcwlw.sys.permission.entity.PermissionDTO;

/**
 * @ClassName. PermissionDAO
 * @Description. TODO
 * @author zhangyang
 * @date 2015年8月10日 下午5:19:58
 * @version V1.0
 */
@Repository
public class PermissionDAO extends BaseDao<PermissionDTO, String> {

	public List<PermissionDTO> getChildPermissionByModuleId(List<String> moduleIds){
		return sqlSessionTemplate.selectList(getMapperMethodId("getChildPermissionByModuleId"), moduleIds);
	}
	
	public List<PermissionDTO> queryPermissionByRoleId(String roleId){
		return sqlSessionTemplate.selectList(getMapperMethodId("queryPermissionByRoleId"),roleId);
	}
	
	public PermissionDTO findPermissionInfoById(String permissionId){
		return sqlSessionTemplate.selectOne(getMapperMethodId("findPermissionInfoById"),permissionId);
	}
	
	public List<String> findPermissionOwnMenusById(String permissionId){
		return sqlSessionTemplate.selectList(getMapperMethodId("findPermissionOwnMenusById"),permissionId);
	}
	
	public int countPermissionByNameWithModuleId(PermissionDTO permissionDTO){
		return sqlSessionTemplate.selectOne(getMapperMethodId("countPermissionByNameWithModuleId"), permissionDTO);
	}
	
	public List<PermissionDTO> getRolePermissions(String[] roleIds){
		return sqlSessionTemplate.selectList(getMapperMethodId("getRolePermissionsByRoleIds"), roleIds);
	}
}
